#include <stdlib.h>
#include <stdio.h>


#include "list.h"
struct node {
	ElementType ele;
	PtrToNode next;
};


List newList() {
	PtrToNode header = (PtrToNode) malloc(sizeof(Node));
	header->ele = 0.1;
	header->next = NULL;
	return header;
}

int isEmpty(List l) {
	return l->next == NULL ? 1 : 0;
}

void printList(List l) {
	if (isEmpty(l)) {
		printf("list is empty\n");
		return;
	}
	PtrToNode curr = l;
	int index = 0;
	while ((curr = curr->next) != NULL) {
		printf("index=%d, ele=%f\n", (++index), curr->ele);
	}
}

void insert(List l, ElementType x) {
	PtrToNode last = l;
	while (last ->next != NULL) {
		last = last->next;
	}
	PtrToNode aNode = (PtrToNode) malloc(sizeof(Node));
	last->next = aNode;
	aNode->ele = x;
}